package money.pot.app;

import java.security.acl.Group;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.EditText;
import android.widget.Toast;

public class MoneyPotApp<Button> extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        super.onCreate(savedInstanceState);

        @SuppressWarnings("unchecked")
		final Button button1 = (Button) findViewById(R.id.button1); // Start Application
        ((View) button1).setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                setContentView(R.layout.main2);
                
                @SuppressWarnings("unchecked")
        		final Button button1 = (Button) findViewById(R.id.button1); // Create New Group
                ((View) button1).setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        setContentView(R.layout.main3);
                        
                        final EditText edittext = (EditText) findViewById(R.id.Groupname);
                        edittext.setOnKeyListener(new OnKeyListener() {
                            public boolean onKey(View v, int keyCode, KeyEvent event) {
                                // If the event is a key-down event on the "enter" button
                                if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
                                    (keyCode == KeyEvent.KEYCODE_ENTER)) {
                                  // Perform action on key press
                                  //Toast.makeText(HelloFormStuff.this, edittext.getText(), Toast.LENGTH_SHORT).show();
                                  return true;
                                }
                                return false;
                                
                            }
                        });
                                              
                    }
                }); //button
                
                @SuppressWarnings("unchecked")
        		final Button button2 = (Button) findViewById(R.id.button2); // Use Existing Group
                ((View) button2).setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        setContentView(R.layout.main4);
                        
                    }
                }); //button
                        
            }
        }); //button
    }
}